furny.furndb
Class PNGLoader

java.lang.Object
  extended by furny.furndb.PNGLoader
All Implemented Interfaces:
com.jme3.asset.AssetLoader

public class PNGLoader
extends java.lang.Object
implements com.jme3.asset.AssetLoader

AssetLoader implementation to load PNG files.

Since:
10.08.2012
Author:
Stephan Dreyer

Field Summary
static java.awt.image.ColorModel AWT_RGBA4444
           
static java.awt.image.ColorModel AWT_RGBA5551
           
 
Constructor Summary
PNGLoader()
           
 
Method Summary
private  byte[] extractImageData(java.awt.image.BufferedImage img)
          Gets a byte array from an image.
private  void flipImage(byte[] img, int width, int height, int bpp)
          Flips an image in the byte buffer.
 java.lang.Object load(com.jme3.asset.AssetInfo info)
           
 com.jme3.texture.Image load(java.awt.image.BufferedImage img, boolean flipY)
          Converts an buffered image to a JME image.
 com.jme3.texture.Image load(java.lang.String key, boolean flipY)
          Loads an image from the furniture db.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

AWT_RGBA4444

public static final java.awt.image.ColorModel AWT_RGBA4444

AWT_RGBA5551

public static final java.awt.image.ColorModel AWT_RGBA5551
Constructor Detail

PNGLoader

public PNGLoader()
Method Detail

extractImageData

private byte[] extractImageData(java.awt.image.BufferedImage img)
Gets a byte array from an image.

Parameters:
img - The image
Returns:
The byte array.
Since:
10.08.2012

flipImage

private void flipImage(byte[] img,
                       int width,
                       int height,
                       int bpp)
Flips an image in the byte buffer.

Parameters:
img - The image
width - The width of the image
height - The height of the image
bpp - The color depth (bits per pixel)
Since:
10.08.2012

load

public com.jme3.texture.Image load(java.awt.image.BufferedImage img,
                                   boolean flipY)
Converts an buffered image to a JME image.

Parameters:
img - The image to convert
flipY - Flips the image if true
Returns:
The JME image
Since:
10.08.2012

load

public com.jme3.texture.Image load(java.lang.String key,
                                   boolean flipY)
                            throws java.io.IOException
Loads an image from the furniture db.

Parameters:
key - The key of the image
flipY - Flips the image if true
Returns:
The JME image.
Throws:
java.io.IOException - if byte/image conversion fails
Since:
10.08.2012

load

public java.lang.Object load(com.jme3.asset.AssetInfo info)
                      throws java.io.IOException
Specified by:
load in interface com.jme3.asset.AssetLoader
Throws:
java.io.IOException